package org.vt.scheduleapp;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;

import android.content.Context;

public class ToDoWriter {

	private final String FILENAME = "todoList_file.txt";
	private FileOutputStream fos;
	private Context mCtx;
	
	public ToDoWriter(Context context)
	{
		mCtx = context;
	}
	
	public void writeTodo(List<ToDoList> todos) throws IOException, FileNotFoundException
	{
		fos = mCtx.openFileOutput(FILENAME, Context.MODE_PRIVATE);
		for(ToDoList todo:todos)
		{
			String todoString = "\n" + todo.toString();
			fos.write(todoString.getBytes());
			
		}
		fos.close();
	}
}
